<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$title}-{$Think.lang.web_name}</title>
    {include file="comm/header"/}
</head>
<body>
{include file="comm/left_menu"/}
{include file="comm/top_menu"/}
<div class="container main">
    <div class="col-sm-12 border-bottom text-right"><a class="btn btn-primary mgr-10" href="/power/group_list/id/{$group.group_id}"><i class="fa fa-list-ul"></i>&nbsp;{$Think.lang.group_list}</a></div>

    <div class="col-sm-12">
        <div class="col-sm-12"> &nbsp;</div>
        <form class="form-horizontal" method="post" action="/power/group_save/">

            <div class="form-group">
                <label class="col-sm-3 control-label">{$Think.lang.group_title}</label>
                <div class="col-sm-3">
                    <input class="form-control" name="group_title" value="{$group.group_title}">
                </div>
                <small class="col-sm-4 form-tips">汉字</small>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">{$Think.lang.group_status}</label>
                <div class="col-sm-3">

                    <label class="s-label-radio">
                        <input type="radio" id="group_status_0" class="radio radio-inline" name="group_status" value="0" {if in_array($group.group_status,[0])}checked{/if} >
                        <label class="fa fa-check" for="group_status_0"></label> {$Think.lang.group_status_0}
                    </label>
                    <label class="s-label-radio">
                        <input type="radio" id="group_status_1" class="radio radio-inline" name="group_status" value="1" {if in_array($group.group_status,[1,""])}checked{/if}>
                        <label class="fa fa-check" for="group_status_1"></label> {$Think.lang.group_status_1}
                    </label>
                </div>
                <small class="col-sm-4 form-tips"></small>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">{$Think.lang.group_rules}</label>
                <div class="col-sm-3">

                </div>
                <small class="col-sm-4 form-tips"></small>
            </div>
            {foreach name="menu_list" key="key" id="v" index="i"}
            <div class="form-group" style="margin-bottom:0.3em;">
                <label class="col-sm-3 control-label">{if $i=="1"}{$Think.lang.group_rules}{/if}</label>
                <div class="col-sm-3">
                    <input class="form-control"  value="{$v.add_str|raw}{$v.menu_title}" disabled style="background: #fff;">
                </div>
                <small class="col-sm-4 form-tips">
                    <label class="s-label-checkbox">
                        <input type="checkbox" name="group_rules[]" value="{$v.menu_id}" id="group_rules_{$i}" {if in_array($v.menu_id,$group_rules)} checked {/if}>
                        <label for="group_rules_{$i}" class="fa fa-check"></label>
                    </label>
                </small>
            </div>
            {/foreach}
            <div class="form-group" style="margin-bottom: 4em;margin-top: 1em;">
                <label class="col-sm-3 control-label"></label>
                <div class="col-sm-7">
                    <a href="javascript:all_select();" class="btn btn-primary" style="margin-right: 2em;">全选</a>
                    <a href="javascript:not_all_select();" class="btn btn-primary">全不选</a>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label"></label>
                <div class="col-sm-3">
                    <input type="hidden" name="group_id" value="{$group.group_id}">
                    <input type="hidden" name="group_org_type" value="0">
                    <input type="hidden" name="group_org_id" value="1">
                    <input type="hidden" name="token" value="">
                    <button class="btn btn-primary" type="submit">提交保存</button>
                </div>
                <small class="col-sm-4 form-tips"></small>
            </div>

        </form>
    </div>
</div>

{include file="comm/footer"/}
<script type="text/javascript">
function all_select() {
    var checked = $("input[name='group_rules[]']");
    for (var i=0,len=checked.length;i<len;i++){
        checked[i].checked = true;
    }
}
function not_all_select() {
    var checked = $("input[name='group_rules[]']");
    //$("input[name='group_rules[]']").removeAttr("checked");
    //$("input[name='group_rules[]']").attr("checked",false);
    for (var i=0,len=checked.length;i<len;i++){
        checked[i].checked = false;
    }
}

</script>
</body>
</html>